package com.qiu.wbpostman.dao;

import java.util.List;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;

import com.qiu.wbpostman.common.PMF;
import com.qiu.wbpostman.entity.UserMail;

public class UserMailDao extends BaseDao {

	private PersistenceManager pm;

	public UserMailDao(Class<?> class1) {
		super(class1);
		pm = PMF.get().getPersistenceManager();
	}

	public UserMail getUserMailById(Long id) {
		UserMail userMail = new UserMail();
		Query query = pm.newQuery(UserMail.class, "id==idParam");
		query.declareParameters("Long idParam");
		try {
			List<UserMail> results = (List<UserMail>) query.execute(id);
			if (results.iterator().hasNext()) {
				userMail = results.get(0);
			}
		} finally {
			query.closeAll();
		}
		return userMail;
	}
}
